import 'package:flutter/material.dart';
import 'package:hive_ce_flutter/adapters.dart';
import 'package:hive_demo/hive/hive_boxes.dart';
import 'package:hive_demo/page/home_page.dart';
import 'package:hive_demo/page/info_screen.dart';
import 'package:hive_demo/page/shelf_page.dart';
import 'package:hive_demo/page/show_data.dart';


import 'hive/model/book.dart';
import 'hive/model/chapter.dart';


Future<void> main() async {
  await Hive.initFlutter();

  Hive
    ..registerAdapter(BookAdapter())
    ..registerAdapter(ChapterAdapter());

  await Hive.openBox<Book>(bookBox);
  await Hive.openBox<Chapter>(chapterBox);

  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue),
      ),

      routes: {
        '/shelf': (context) => const ShelfPage(),
        '/data': (context) => const ShowData(),
        '/test': (context) => const InfoScreen(),
      },

      home: HomePage(),
    );
  }
}